<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<link href="/css/home/replacerecharge.css" media="screen" rel="stylesheet" type="text/css" > 
<script type="text/javascript" src="/js/boxy/js/jquery.boxy.js"></script>

<script type="text/javascript">
    $(function(){
        window.alert = Boxy.alert;
    });
    <?php if($this->ma == 1) { ?>
        alert("商品修改成功！");
        location.href="/admini/goods/index";
    <?php }?>
</script>
<div class="admin_nrtop">
    <div class="ad_search" style="font-size: 24px;">
        修改商品
    </div>
</div>
<style>
    .add_div table{width: 960px;font-size: 16px;}
    .add_div table tr{height: 36px;}
    .add_div table .bf{text-align: right;margin-right: 5px;width:120px;}
    .add_div table input{font-size: 16px;width: 280px;}
    .add_div table select{font-size: 16px;width: 280px;}
    #getinfo{float: right;    height: 32px;    padding: 0 10px;}
</style>
<div  class="biaoge">
    <div class="add_div">
        <form action="" method="post">
           <div class="applytable">
                    <table>
                        <tr>
                            <td class="z">商品详情链接：</td>
                            <td>
                                <div class="input" style="border:0px;width: 600px;">                    
                                        <input class="required" type="text" id="itemurl"  style="width:450px;" value="<?php echo $this->Item->url; ?>"/>
                                       <button id="getinfo" type="button">获取信息</button>
                                        <span style="color: red;display: none;" id="error">获取失败！</span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">商品名称：</td>
                            <td>
                                <div class="input" style="border:0px;">     
                                        <input class="required" type="text" id="title" value="<?php echo $this->Item->title; ?>" name="title"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">商品地址：</td>
                            <td>
                                <div class="input" style="border:0px;">                       
                                        <input class="required" value="<?php echo $this->Item->url; ?>" type="text" id="url" name="url"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">商品价格：</td>
                            <td>
                                <div class="input" style="border:0px;">
                                        <input class="required" value="<?php echo $this->Item->price; ?>" type="text" id="price" name="price"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">商品原价：</td>
                            <td>
                                <div class="input" style="border:0px;">
                                        <input class="required" value="<?php echo $this->Item->cost; ?>" type="text" id="cost" name="cost"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">图片地址：</td>
                            <td>
                                <div class="input" style="border:0px;">
                                        <input class="required" type="text" value="<?php echo $this->Item->picurl; ?>" id="picurl" name="picurl"/>
                                </div>
                            </td>
                        </tr>                      
                         <tr>
                            <td class="z">月销售量：</td>
                            <td>
                                <div class="input" style="border:0px;">                           
                                        <input class="required" type="text" value="<?php echo $this->Item->volume; ?>" id="volume" name="volume"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">&nbsp;</td>
                            <td>
                                 <input class="required" type="hidden" value="<?php echo $this->Item->menuid; ?>" id="menuid" name="menuid"/>
                                <div class="botton" style="width:600px;">
                                    <input type="submit" value="修改">                                    
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
          </form>
    </div>
 </div>
<script>
$("#getinfo").click(function(){
    sVal=$("#itemurl").val();
    $.post("/purchase/getinfo",{url:sVal},function(data){
        if(data.success){//成功,设置             
          $("#title").val(data.name);
          $("#url").val(data.url);
          $("#price").val(data.price);
          $("#cost").val(data.price);
          $("#picurl").val(data.image);
          //$("#volume").val(data.image);
          $("#error").hide();
        }else{
            $("#error").show();
        }
   
     });
});
</script>